<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/header.jsp" %>
<script type="text/javascript">
var selectTreeNode = zTree.getSelectedNodes()[0];

var butFlag=$("#operateType").val();//用来判断当前页面是属于查看、新增、修改页面，从而判断点击取消按钮时的响应事件，查看：直接关闭
var defaultRolesValue=$("#defaultRolesValue").val();
var userProductStr=$("#userProductStr").val();

var srcData="";
var userFormContent="";
var scripts = [null, null];
$('.page-content-area').ace_ajax('loadScripts', scripts, function() {
	
	$("#userIdDiv").hide();
    initButtons();
  	//时间插件切换目录后失效，加载前清下$("#ui-datepicker-div")
	$("#ui-datepicker-div").remove();
  
    Orginput.init(
    		$("#orgId"),
    		{defaultOrgId:"${userInfo.orgId}",clickType:"org",defaultOrgName:"<hw:orgName orgId="${userInfo.orgId}" />(${userInfo.orgId})",
	        afterSelect: function() {
	        }
    });
    
  	//~~~~~~~~~~~~~~~~~ 勾选默认角色的值  START~~~~~~~~~~~~~
	var defaultRolesArray = defaultRolesValue.split(',');
 	var roleArray=new Array();
	$("#roleModifyInfo :input").each(function(){
		var cur=$(this).val();
		roleArray.push(cur);
	});
	$.each(defaultRolesArray,function(i,value){
		if($.inArray(value,roleArray)){
			$("#roleModifyInfo input[id=userRolesId"+value+"]").prop('checked', true);
		}
 	});
	//~~~~~~~~~~~~~~~~~ 勾选默认角色的值  END~~~~~~~~~~~~~
	
	
	//~~~~~~~~~~~~~~~~~ 勾选默认产品 START~~~~~~~~~~~~~
	var userProductStrArray = userProductStr.split(',');
 	var productArray=new Array();
	$("#productModifyInfo :input").each(function(){
		var cur=$(this).val();
		productArray.push(cur);
	});
	$.each(userProductStrArray,function(i,value){
		if($.inArray(value,productArray)!=-1){
			$("#productModifyInfo input[id=productId"+value+"]").prop('checked', true);
		}
 	});
	//~~~~~~~~~~~~~~~~~ 勾选默认产品的值  END~~~~~~~~~~~~~
	
	//~~~~~~~~~~~~~~~~~ 动态验证证件类型和证件号  START~~~~~~~~~~~~~
	$('#cardNo').on('change', function () {
		$("#cardNo").removeData("previousValue"); 
		$("#cardNo").valid();
    });
	//~~~~~~~~~~~~~~~~~ 动态验证证件类型和证件号  END ~~~~~~~~~~~~~
	
	$.widget("ui.dialog", $.extend({}, $.ui.dialog.prototype, {
		_title: function(title) {
			var $title = this.options.title || '&nbsp;'
			if( ("title_html" in this.options) && this.options.title_html == true )
				title.html($title);
			else title.text($title);
		}
	}));
	$("#userForm").data("originInfo",$("#userForm").html());//初始化界面
	userFormContent=$("#userForm").data("originInfo");
});

function initButtons() {
	if(butFlag=="insert"){
		$("#userIdDiv").hide();
		$("#btnUPwdModify").hide();
        $("#btnUModify").hide();
        $("#btnUDelete").hide();
        $("#btnUSave").show();
        $("#btnUCancle").hide();
        $("#btnUClose").show();
        $("#orgId").attr("disabled",true);
        writeOption();
        
	}else if(butFlag=="queryDetail"){
        $("#btnUPwdModify").show();
        $("#btnUSave").hide();
        $("#btnUModify").show();
        $("#btnUDelete").show();
        $("#btnUCancle").hide();
        $("#btnUClose").show();
        writeOption();
        $("#roleModifyInfo input[type=checkbox]").each(function(){
        	if($(this).val() == "04" || $(this).val() == "x1"){
        		$("#productManagerView").show();
        	}
        	$(this).prop('checked', true);
        });
        disabledAll("userForm");
    }
}
    

function modify(){
	enabledAll("userForm");
	var params ={"userId":$("#userId").val()};
	$.ajax({
	   	async : false,
	    url : "${ctx}/user/listEnableRoles.do",
	    data : params,
	    type : "POST",
	    cache:false,
	    dataType : "json",
	    success: function(data){
	            srcData=$("#roleModifyInfo").html();
	            $("#roleModifyInfo").data("srcData",srcData);
	            $("#roleModifyInfo").html("");
	            var arr=new Array();
                $.each(data.chooseRoleList,function(index,value){
				   	   arr.push(value.roleId);
				});
				$.each(data.data,function(index,value){
				   	   var html='<label>'+
			                    '<input type="checkbox"  class="ace ace-checkbox-2  no-margin-left roleIdstatus" name="roles['+index+'].roleId" id="userRoles_'+value.roleId+'" value="'+value.roleId+'" onchange="sel(this);"'+($.inArray(value.roleId,arr)>=0?'checked':'')+'/>'
			                    +'<span class="lbl padding-2">'+value.roleName+'</span>'
			                    '</label>';
			                    $("#roleModifyInfo").append(html);
			               });
			        },
			        error: function(data) {
			        	alert(data);
	                }
			    }); 
				
	   $("#btnUPwdModify").hide();
	   $("#btnUSave").show();
	   $("#btnUModify").hide();
	   $("#btnUDelete").hide();
	   $("#btnUCancle").show();
	   $("#btnUClose").show();
		        
	   $("#userCode").attr("disabled",true);
	   $("#createUser").attr("disabled",true);
	   $("#createTime").attr("disabled",true);
	   $("#updateUser").attr("disabled",true);
	   $("#updateTime").attr("disabled",true);
}

//表单验证
$("#userForm").validate({
	debug:true,
    errorElement: 'div',
    errorClass: 'help-block',
    focusInvalid: false,
    onfocusout: function(element){
        $(element).valid();
    }, 
    rules: {
       userName: {
          required: true,
          stringMaxLength:30,
       },
       orgId: {
          required: true,
          stringMaxLength:30
       },
       cardType: {
    	  required: true
       },
       /*  cardNo: {
			required:true,
          stringMaxLength:30,
          isIdCardNo:true,
          remote:{
        	  url: "${ctx}/user/validateCard",     //后台处理程序 
        	  type: "post",               //数据发送方式
        	  dataType: "json",           //接受数据格式   
        	  cache:false,
        	  data: {                     //要传递的数据
        		cardType: function() {
        	      return $("#cardType").val();
        	   	}, 
        		cardNo: function() {
        	      return $("#cardNo").val();
        	   	},
        	   	flag:function() {
        	      return $("#operateType").val();
        	   	} ,
        	   	userId:function() {
        	      return $("#userId").val();
        	   	}
          	  }
          }
       }, */
       status:{
      	  required: true
       },
       userRoles: {
          required: false
       },
       userCode:{
     	  required: true,
     	  remote:{
	       	  url: "${ctx}/user/validateCode",     //后台处理程序 
	       	  type: "post",               //数据发送方式
	       	  dataType: "json",           //接受数据格式   
	       	  cache:false,
	       	  data: {                     //要传递的数据
	       		userCode: function(){
	       			return $("#userCode").val();
	       		}
	       	  }
          }
       },
       gender:{
     	  required: true
       }
    },

    messages: {
    	userName: {
           required: "用户名不能为空!"
        }, 
        orgId: {
           required: "所属机构不能为空!",
        }, 
       /*  cardNo: {
           required: "证件号码不能为空!",
           rangelength: $.validator.format("请输入 {0} 到 {1} 之间的字符"),
           remote:$.validator.format("该证件号码已被注册")
        },  */ 
        status:{
      	   required: "用户状态不能为空!",
        },
        userRoles: {
           required: "用户角色不能为空!",
        },
        userCode:{
       	   required: "用户编码不能为空！",
       	   remote : "该用户编码已存在!"
        },
        gender:{
       	   required: "性别不能为空！",
        }
    },

    highlight: function (e) {
        $(e).closest('.form-group').removeClass('has-info').addClass('has-error');
    },

    success: function (e) {
        $(e).closest('.form-group').removeClass('has-error').addClass('has-info');
        $(e).remove();
    },

    errorPlacement: function (error, element) { //指定错误信息位置
    	if(element.is(':radio') || element.is(':checkbox')) { //如果是radio或checkbox
	    	var eid = element.attr('name'); //获取元素的name属性
	    	error.appendTo(element.parent()); //将错误信息添加当前元素的父结点后面
    	}else{
    		error.insertAfter(element);
    	}
    }
});
	
$('#userName').on('blur', function() {
    $("#userForm").validate().element( this );
});
 

function save(){
	//校验userForm表单
	if(!$('.roleIdstatus:checked').length > 0){
		alert('请至少选择一个角色');
		return false;
	}
	if ($("#userForm").valid() == false) {
		alert("请检查表单是否正确填写");
	    return false;
	}
	var userId = $("#userId").val();
	var url ="";
	if(userId !=""){ //userId不为空为修改操作
		url ="${ctx}/user/updateUser.do";	
	}else{ //userId为空为新增操作
		url ="${ctx}/user/insertUser.do";	
	}
	var param;
	if(butFlag=="insert"||butFlag=="queryDetail"){
        var s = "修改";
        if(butFlag=="insert"){
            s = '新增';
            if(selectTreeNode.messageType == "dept"){
	    		param= {"deptId":selectTreeNode.id};
	     	}else if(selectTreeNode.messageType == "org"){
	     		param= {"orgId":selectTreeNode.id};
	     	}
        }else if(butFlag=="queryDetail"){
        	var orgData=$("#selectOrgOrDeptFlag").data("orgData");
        	if(!orgData){
        		param={"orgId":$("#orgIdQuery").val()}
        	}else{
        		param=orgData;
        	}
        }
        var flag = confirm("确认"+s+"吗？");
        if(flag){
        	saveUserInfo(url,param); 
        }
	}
}

function saveUserInfo(url,param){
	if(!param){
		param={"deptId":$("#deptId").val(),"orgId":$("#orgId").val()};
	}
	enabledAll("userForm");
    $.ajax({
    	async : false,
        url : url,
        data : $("#userForm").serialize(),
        type : "POST",
        cache:false,
        dataType : "json",
        success: function(ret){	
             if (ret.status == "ok") {
                 alert(ret.message);
                 $("#userInfoDiv").dialog("close");
                 $("#userListDiv").load("${ctx}/user/list",param);
                 //刷新数据
                 //var treeParam = {"checkType":"org","isCheckOrg":"0"};
				 //$("#orgTreeDiv").load("${ctx}/org/haveRootNodes.do",treeParam);
				 //freshDeptPage(msg.retDeptId);
              } else{						  
            	 alert(ret.message);
              }	
            },
        error: function(ret){
               alert(ret.responseText);
               disabledAll("userForm");
         }
    });	
}
//取消修改或新增
function cancle(){
    if(butFlag=="insert"||butFlag=="queryDetail"){
        var s = "修改";
        if(butFlag=="insert"){
            s = '新增';
        }
        var flag = confirm("确认取消"+s+"吗？");
        if(flag){
        	if(butFlag=="queryDetail"){
            	$("#userForm").html("");
            	$("#userForm").append(userFormContent);
            	disabledAll("userForm");
            	initButtons();
            	var userProductStrArray = userProductStr.split(',');
             	var productArray=new Array();
            	$("#productModifyInfo :input").each(function(){
            		var cur=$(this).val();
            		productArray.push(cur);
            	});
            	$.each(userProductStrArray,function(i,value){
            		if($.inArray(value,productArray)!=-1){
            			$("#productModifyInfo input[id=productId"+value+"]").prop('checked', true);
            		}
             	});
        	}
        	if(butFlag=="insert"){
                $(this).dialog("close");
            }
        }
    }
}
//删除用户
function del() {
	var status =$("#status").val();
	if(status !="0" ){
		alert("只能删除【未启用】状态的用户!");
		return;
	}
	var flag = confirm("确认删除吗？");
	
	var	param={"deptId":$("#deptId").val(),
			 	"orgId":$("#orgId").val()
			};

	if (flag) {
		enabledAll("userForm");
		$.ajax({
			url : "${ctx}/user/deleteUser.do",
			async : false,
			data : $("#userForm").serialize(),
			type : "POST",
			cache:false,
			dataType : "json",
			success : function(data) {
				var ret =data;
				if (ret.status == "ok") {
					alert(ret.message);
					$("#userInfoDiv").dialog("close");
					$("#userListDiv").off().load("${ctx}/user/list.do",param);
					//var treeParam = {"checkType":"org","isCheckOrg":"0"};
				    //$("#orgTreeDiv").load("${ctx}/org/haveRootNodes.do",treeParam);
				} else {
					alert(ret.message);
				}
			},
			error : function (ret) {
				alert(ret.responseText);
				disabledAll("userForm");
			}
		});
	}
}

//自定义菜单
function menuModify(){
    var relationId =$("#rela").val();
    $("#privateMenu").show();
   	$("#privateMenu").load("${ctx}/user/toUserMenuApply.do?relationId="+relationId);	
   	$('#privateMenu').dialog('open');
   	$("#userInfoDiv").dialog('close');
}

//角色详细信息
$('#privateMenu').dialog({
	hide:false,
	autoOpen:false,
	width: 650,
	height:550,
	modal:true,
	//bgiframe:true,
	title: "<div class='widget-header'><h4 class='smaller'><i class='ace-icon fa fa-cog green'></i>&nbsp; 用户角色菜单</h4></div>",
	title_html: true,
	buttons: [
				{
					id: "btnSur",
					html: "<i class='ace-icon fa fa-floppy-o bigger-110'></i>&nbsp; 确认",
					"class" : "btn btn-success btn-minier",
					click: function() {
						saveUserPrivateMenu();
					}
				},											
				{
					id: "btnRClose",
					html: "<i class='ace-icon fa fa-times bigger-110'></i>&nbsp; 关闭",
					"class" : "btn btn-minier",
					click: function() {
						$(this).dialog("close");
					}
				}				
			]	
});


//保存用户菜单信息
function saveUserPrivateMenu(){
	var userMenudIdArray=new Array();
	var checkedList=$("#userMenuTree").find("[name='treecheckbox']:checked");
	checkedList.each(function(){
		var menuId=$(this).attr("id");
		userMenudIdArray.push(menuId);
	});
	var param={
			privateMenuList:menudIdArray.toString(),
			relationId:$("#rela").val()
	};
	$.ajax({
		async : false,
		url: "${ctx}/user/userMenuApply.do",
		type:"post",
		data: param,
		cache:false,
		dataType:"json",
		success: function(ret){	
				alert(ret.message);
		},
		error: function(ret){
			alert(ret.message);
		}
	});
}


//重置密码
function pwdModify(){
	enabledAll("userForm");	
    $.ajax({
    	async : false,
        url : "${ctx}/user/resetPwd.do",
        data : $("#userForm").serialize(),
        type : "POST",
        cache:false,
        dataType : "json",
        success: function(data){	
               alert(data[1]);
               disabledAll("userForm");
        },
        error: function(data){
               alert(data[1]);
               disabledAll("userForm");
        }
    });	
}



//取消修改时，恢复数据
function recoverData(json){
    writeOption();
}


	//根据选中的角色生成下拉列表
	function sel(obj) {
		//如果角色是产品经理时显示
		if($("#userRoles_04").is(":checked") == true || $("#userRoles_x1").is(":checked") == true){
			$("#productManagerView").show();
		}else{
			$("#productManagerView").hide();
		}
		
		$(".roleIdstatus").each(function(){
			/* var roleId=$(this).val();
			//如果是市行产品经理
			if(roleId=="04"){
				$("#productManagerView").show();
			}
			if(($(obj).val()=="04" || $(obj).val()=="x1") && obj.checked==false){
				$("#productManagerView").hide();
			} */
			if(!$(this).attr('checked')){
				$(this).attr('disabled');
			}
		});
	}

	//画option
	function writeOption() {
		$("#defaultRole").find("option").remove();
		var userRoles = document.getElementsByName('userRoles');
		var roleNames = document.getElementsByName('roleNames');
		var str = "";
		var dr = $("#defaultRoleId").val();
		for (var i = 0; i < userRoles.length; i++) {
			if (userRoles[i].checked) {
				if (userRoles[i].value == dr) {
					str += "<option value='"+userRoles[i].value+"' selected='selected'>"
							+ roleNames[i].value + "</option>";
				} else {
					str += "<option value='"+userRoles[i].value+"'>"
							+ roleNames[i].value + "</option>";
				}
			}
		}
		$("#defaultRole").append(str);
	}

	//只允许输入数字  
	function checkkey2(value, e) {
		var key = window.event ? e.keyCode : e.which;
		if ((key == 46) || (key > 95 && key < 106) || (key > 47 && key < 60)) {
		} else if (key != 8) {
			if (window.event) //IE   
			{
				e.returnValue = false; //event.returnValue=false 效果相同.   
			} else //Firefox   
			{
				e.preventDefault();
			}
		}
	}
	//用户Id验证
	function userIdVal() {
		var userId = $('#userId').val();
		if (userId == "") {
			alert("用户编号不能为空！");
			//$('#userId').focus();
		} else if (userId.length != 9) {
			alert("用户编号长度必须为9");
			$('#userId').val("");
			$('#userId').focus();
		}
		var params = {
			"userInfo.userId" : $('#userId').val()
		};
		$.post("${ctx}/user/userIdVal.do", params, function(message) {
			if (message == "1") {
				var flag = confirm("已存在该用户编号,是否引用该用户信息？");
				if (flag) {
					$.post("${ctx}/user/selectUserInfoByUserId.do", params,
							function(userInfo) {
								//json赋值
								var json = $.parseJSON(userInfo);
								writeJson(json);
							});
				}
			}
		});
	}

	//根据证件号证件类型进行唯一性验证
	function cardOnlyVal() {
		//debugger;
		if (!cardIdVal()) {
			return;
		}
		var params = {
			"userInfo.cardType" : $('#cardType').val(),
			"userInfo.cardNo" : $('#cardNo').val()
		};
		$.post("${ctx}/user/userValByCard.do", params, function(message) {
			if (message == "1") {
				var flag = confirm("已存在该证件号和证件类型,是否引用该用户信息？");
				if (flag) {
					$.post("${ctx}/user/selectUserInfoByCard.do", params,
							function(userInfo) {
								//json赋值
								var json = $.parseJSON(userInfo);
								writeJson(json);
							});
				}
			}
		});
	}

	//验证是否可选择任职状态
	function relationStatusVal() {
		if ($('#status').val() == "") {
			alert('请先选择用户状态！');
		}
	}

	//验证是否可选择不是"未启动"的任职状态
	function relationStatusVal2() {
		if ($('#status').val() == "0"
				&& ($('#relationStatus').val() != "0" && $('#relationStatus')
						.val() != "")) {
			alert('由于用户状态为未启用，任职状态只能选择未启用！');
			$('#relationStatus').val("");
		}
	}

	//身份证校验
	function cardIdVal() {
		if ($('#cardType').val() == '01') {
			var cardNo = $('#cardNo').val();
			return isChinaIdNo(cardNo);
		} else {
			return true;
		}
	}

	//验证必输项
	function nullVal() {
		var form = $("#userForm");
		if (form.length == 0) {
			return true;
		}
		var isSuccessValid = form.valid();
		if (isSuccessValid == true) {
			var f = true;
			var userId = "";
			var userIdAuto = $('#userIdAuto').val();
			if (userIdAuto == "yes") {
				userId = "111";
			} else {
				userId = $('#userId').val();
			}
			var userRoles = document.getElementsByName('userRoles');
			for (var i = 0; i < userRoles.length; i++) {
				if (userRoles[i].checked) {
					f = false;
					break;
				}
			}
			if (f) {
				alert("角色不能为空！");
				return false;
			} else if (cardIdVal()) {
				if (userId != "" && $("#orgId").val() != ""
						&& $("#deptId1").val() != "") {
					return true;
				} else {
					return false;
				}
			} else {
				return false;
			}
		}
		return false;
	}

	//限制长度
	function lenVal(o, maxLen) {
		checkTextArea(o, maxLen);
		o.value = o.value.substring(0, maxLen / 2);
	}

	//去掉首尾空格
	function LTrim(str) {
		var i;
		for (i = 0; i < str.length; i++) {
			if (str.charAt(i) != " " && str.charAt(i) != " ")
				break;
		}
		str = str.substring(i, str.length);
		return str;
	}

	function RTrim(str) {
		var i;
		for (i = str.length - 1; i >= 0; i--) {
			if (str.charAt(i) != " " && str.charAt(i) != " ")
				break;
		}
		str = str.substring(0, i + 1);
		return str;
	}
	function Trim(str) {
		return LTrim(RTrim(str));
	}
	//去掉首尾空格后返回
	function getTrim(o) {
		o.value = Trim(o.value);
		validateAlias();
	}
	function validateAlias() {
		var userName = $("#userName").val();
		if (userName == '') {
			return false;
		}
		var params = {
			"userInfo.userName" : userName,
			"userInfo.userId" : $("#userId").val()
		};
		$.post("${ctx}/user/validateUserName.do", params, function(message) {
			if (message == "1") {
				alert("该用户名已经被占用，请换一个，如加上数字");
				return false;
			} else {
				return true;
			}
		});
		return true;
	}
</script>
    
    <div id="tab1" class="row">
    <div class="col-xs-12">	
    <form id = "userForm" name = "userForm" class="form-horizontal" role="form">
    	  
      	  <div   class="form-group" id="userIdDiv">
                    <label class="col-sm-4 control-label no-padding-right" for="userId">用户ID：<font color="red">*</font></label>
                    
                    <div class="col-sm-8">
                           <div class="grid_4">
                           		<input width="10" type="text" class="col-xs-10 col-sm-8"  id="userId" title="用户编号由系统自动生成" name="userId" placeholder="用户编号由系统自动生成" value="${userInfo.userId}" maxlength="11" onkeydown="checkkey2(this.value,event)"  readonly />
                           </div>
                    </div>
          </div>
          <div class="form-group">
                    <label class="col-sm-4 control-label no-padding-right" for="userCode">人力资源编号：<font color="red">*</font></label>
                    <div class="col-sm-8">
                      <div class="clearfix">
                           <input type="text" class="col-xs-10 col-sm-8 form-txt "  id="userCode"  maxlength='11' placeholder="用户编码不能为空且不含中文" name="userCode" value="${userInfo.userCode}" onkeyup="value=value.replace(/[^\w\.\/]/ig,'')"/>
                      </div>
                    </div>
          </div>
          <div class="form-group">
                    <label class="col-sm-4 control-label no-padding-right" for="userName">用户名：<font color="red">*</font></label>
                    <div class="col-sm-8">
                      <div class="clearfix">
                           <input type="text" class="col-xs-10 col-sm-8 form-txt "  id="userName" placeholder="请输入用户名" name="userName" value="${userInfo.userName}"/>
                      </div>
                    </div>
          </div>
          
          <div class="form-group">
                    <label class="col-sm-4 control-label no-padding-right" for="gender">性别：<font color="red">*</font></label>
                    <div class="col-sm-8">
                        <select class="col-xs-10 col-sm-8" id="gender" name="gender">
                           <hw:dictOption dictType="D00003" value="${userInfo.gender}"   defaultValue="2"/>
                        </select>
                    </div>
          </div>
        <%--   <div class="form-group">
                    <label class="col-sm-4 control-label no-padding-right" for="cardNo">身份证号码：</label>
                    <div class="col-sm-8">
                        <div class="clearfix">
                           <input type="text" class="col-xs-10 col-sm-8 form-txt"  id="cardNo"  name="cardNo" value="${userInfo.cardNo}" />
                           <input type="hidden" id="cardType" name="cardType" value="01">
                        </div>
                    </div>
          </div> --%>
          <div class="form-group">
                    <label class="col-sm-4 control-label no-padding-right" for="orgId">所属机构：<font color="red">*</font></label>
                    <div class="col-sm-8">
                    	<div class="clearfix">
                           <input type="text" class="col-xs-10 col-sm-8"  id="orgId"  name="orgId" title="新建用户成功后，用户的所属机构和部门将不能修改！" value="${userInfo.orgId}" />
                        </div>
                    </div>
          </div>
         <%--  <div class="form-group">
                    <label class="col-sm-4 control-label no-padding-right" for="userStatus">是否在职：<font color="red">*</font></label>
                    <div class="col-sm-8">
                    	<div class="clearfix">
                           <select class="col-xs-10 col-sm-8" id="form-field-select-11" data-placeholder="是否在职" name="userStatus">
							 	<hw:dictOption dictType="D00051" value="${userInfo.userStatus}"/>
						   </select>
                        </div>
                    </div>
          </div> --%>
          <div class="form-group">
                    <label class="col-sm-4 control-label no-padding-right" for="status">用户状态：<font color="red">*</font></label>
                    <div class="col-sm-8">
                        <select class="col-xs-10 col-sm-8" id="status" name="status">
                            <hw:dictOption dictType="D00026" value="${userInfo.status}" defaultValue="1"/>
                         </select>
                    </div>
          </div>
          <div class="form-group">
                    <label class="col-sm-4 control-label no-padding-right" for="userRoles">角色：<font color="red">*</font></label>
                    <div class="col-sm-8">
                       <div class="clearfix">			  
                         <div class="checkbox" id="roleModifyInfo">
                           	  <c:forEach items="${userInfo.roles}" var="role" varStatus="i">	
	                               <label>
	                                  <input type="checkbox" style="margin-left:0px;" class="ace ace-checkbox-2 no-margin-left roleIdstatus " data-val="true" name="roles[${i.index }].roleId" 
	                                   value="${role.roleId}"  id="userRolesId${role.roleId}" 
	                                  <c:choose>
		                                   <c:when test="${butFlag}=='queryDetail'"> 
		                                   		checked="checked"
		                                   </c:when>
	                                  </c:choose> 
	                                   
	                                  /> 
	                                  <span class="lbl padding-2">${role.roleName}</span>
	                               </label>	
                              </c:forEach>
                        </div>
  						 </div>
                    </div>
          </div>
          <div class="form-group" id="productManagerView" style="display:none;">
                    <label class="col-sm-4 control-label no-padding-right" for="products">产品：<font color="red">*</font></label>
                    <div class="col-sm-8">
                       <div class="clearfix">			  
                         <div class="checkbox" id="productModifyInfo">
                           	  <c:forEach items="${products}" var="product" varStatus="i">	
	                               <label>
	                                  <input type="checkbox" style="margin-left:0px;" class="ace ace-checkbox-2 no-margin-left products " data-val="true" name="products[${i.index }].productId" 
	                                   value="${product.productId}"  id="productId${product.productId}"
		                                  <c:choose>
			                                   <c:when test="${butFlag}=='queryDetail'"> 
			                                   		checked="checked"
			                                   </c:when>
		                                  </c:choose> 
	                                  /> 
	                                  <span class="lbl padding-2">${product.productName}</span>
	                               </label>	
                              </c:forEach>
                        </div>
  						 </div>
                    </div>
          </div>
            <input type="hidden" id="resetBut" name="resetBut" value="${resetBut}">			
            <input type="hidden" id="operateType" name="operateType" value="${operateType}">
            <input type="hidden" id="defaultRolesValue" value="${defaultRoles}">
            <input type="hidden" id="userProductStr" value="${userProductStr}">  
    </form>
    </div>
    </div>
    <div id="privateMenu"></div>
    <div id="deptIFrame"></div>
